def Prin_mat(Gmat):
    for i in range(Gmat.m):
        for j in range(Gmat.n):
            print(Gmat.mat[i][j], end=" ")
        print()


# def Add_mat(mat1,mat2):

def Mul_mat(mat1, mat2):
    result = Mat(mat1.m, mat2.n)
    for i in range(result.m):
        for j in range(result.n):
            sum = 0
            for k in range(mat1.n):
                sum += mat1.mat[i][k] * mat2.mat[k][j]
    return result


def Ele_mat(mat1, mat2):
    result = Mat(mat1.m, mat2.n)
    for i in range(result.m):
        for j in range(result.n):
            result.mat[i][j] = mat1.mat[i][j] * mat2.mat[i][j]
    return result


class Mat:
    def __init__(self, m, n):
        self.m = m
        self.n = n
        self.mat = [[0 for i in range(n)] for j in range(m)]

    def set_input(self):
        for i in range(self.m):
            for j in range(self.n):
                self.mat[i][j] = int(input().strip())

    def transpose(self):
        result = Mat(self.n, self.m)
        for i in range(self.m):
            for j in range(self.n):
                result.mat[j][i] = self.mat[i][j]
        return result


m, n = map(int, input().split())
mat = Mat(m, n)
mat1 = Mat(m, n)
mat.set_input()
mat1.set_input()
Prin_mat(Mul_mat(mat, mat1))
